
import React from "react";
import { inject, observer } from 'mobx-react'
import XiaLaCaiDan from "../../component/promotion/XiaLaXuanZe";
import {Button} from 'antd'


@inject('xinJianYouHuiJuan')
@observer
class AddClass extends React.Component {

    componentWillMount(){
        this.props.xinJianYouHuiJuan.GuanJianZiSel()
    }

    render() {
        let {bangDing} = this.props
        let {myFrom,goodsList} = this.props.xinJianYouHuiJuan
        let selData = ()=>{
            return this.props.xinJianYouHuiJuan.GuanJianZiSel()
        }
        let data
        if (this.props.xinJianYouHuiJuan.myFrom.couponType === 5) {
            data = <div>
                <div className="itemContentRow">
                    <span>优惠劵金额:</span>
                    <input type="text" value={myFrom.couponAmount} onChange={bangDing('couponAmount')} placeholder="此劵可抵的金额" />
                </div>

                <div className="itemContentRow">
                    <span>订单金额:</span>
                    <input type="text" value={myFrom.couponOa} onChange={bangDing('couponOa')}  placeholder="订单满多少可用" />
                </div>

                <div className="itemContentRow">
                    <span>订单下限:</span>
                    <input type="text" value={myFrom.couponLol} onChange={bangDing('couponLol')}  placeholder="满多少可送此劵" />
                </div>
            </div>
        }else if (this.props.xinJianYouHuiJuan.myFrom.couponType === 6) {
            data = <div>
                <div className="itemContentRow">
                <span>优惠劵金额:</span>
                <input value={myFrom.couponAmount} onChange={bangDing('couponAmount')} type="text" placeholder="此劵可抵的金额" />
            </div>
            <div className="itemContentRow">
                <span>商品关键字:</span>
                <input type="text" value={myFrom.couponPk} onChange={bangDing('couponPk')} placeholder="请输入关键字"  />
                <Button  type="primary" onClick={selData}>搜索</Button>
            </div>

            <div className="itemContentRow">
                <span>优惠商品:</span>
                <XiaLaCaiDan xiaLaData={goodsList} Change={bangDing}/>
            </div>
            </div>
        }else if (this.props.xinJianYouHuiJuan.myFrom.couponType === 7) {
            data = <div>
                <div className="itemContentRow">
                <span>优惠劵金额:</span>
                <input value={myFrom.couponAmount} onChange={bangDing('couponAmount')} type="text" placeholder="此劵可抵的金额" />
            </div>
            <div className="itemContentRow">
                <span>订单金额:</span>
                <input value={myFrom.couponOa} onChange={bangDing('couponOa')} type="text" placeholder="订单满多少可用" />
            </div>

            <div className="itemContentRow">
                <span>所需积分:</span>
                <input value={myFrom.couponRp} onChange={bangDing('couponRp')} type="text" placeholder="兑换此劵需要多少积分" />
            </div>
            </div>
            
        }else{
            data = <div>
                <div className="itemContentRow">
                    <span>优惠劵金额:</span>
                    <input value={myFrom.couponAmount} onChange={bangDing('couponAmount')} type="text" placeholder="此劵可抵的金额" />
                </div>

                <div className="itemContentRow">
                    <span>订单金额:</span>
                    <input value={myFrom.couponOa} onChange={bangDing('couponOa')} type="text" placeholder="订单满多少可用" />
                </div>
            </div>
        }
        return (
            data
        )
    }
}

export default AddClass